
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>12.3适配三方库之FlutterToast · Flutter for Harmony教程</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="坚果派">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mind-maps/mindmaps.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="12.4适配适配三方库之udid.md" />
    
    
    <link rel="prev" href="12.2坚果派已适配的库" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"};
    </script>

    </head>
    <body>
         
<div class="donate-modal modal">
  <div class="modal-header">
    <div>
      <span>
        <img
          id="modal-avatar"
          class="modal-avatar"
          src="http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"
        />
      </span>
      <span id="nickname"> breeze </span>
      <p class="modal-close close" onclick="closeDonateModal()">×</p>
    </div>
    <div class="message">
      <div class="tip">
        <i></i>
        <span>随意打赏，但不要超过一顿早餐钱 💕</span>
      </div>
    </div>
  </div>
  <div class="modal-content">
    <div class="modal-pay-way">
      <div id="wxpay" onclick="showDonateImg(0)">
        <input
          type="radio"
          name="pay-way"
          value="wxpay"
          class="zs-type"
          checked="checked"
        />
        <span>
          <img
            id="wxpay-logo"
            src=""
          />
        </span>
      </div>
      <div id="alipay" onclick="showDonateImg(1)">
        <input type="radio" name="pay-way" value="alipay" class="zs-type" />
        <span>
          <img
            id="alipay-logo"
            src=""
          />
        </span>
      </div>
    </div>
    <div class="modal-pay-qrcode">
      <img id="wxpay-code" src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png" />
      <img
        id="alipay-code"
        src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png"
        hidden
      />
    </div>
  </div>
</div>
<div class="mask"></div>


<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://www.gitbook.com/" target="_blank">坚果派官网</a>
      </li><li>
        <a href="https://www.npmjs.com/package/package" target="_blank">ArkUI实战</a>
      </li><li>
        <a href="https://space.bilibili.com/480883651" target="_blank">元服务开发实践</a>
      </li><li>
        <a href="https://blog.51cto.com/jianguo" target="_blank">OpenHarmony应用开发</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    1.前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../坚果派介绍.html">
            
                <a href="../坚果派介绍.html">
            
                    
                    2.坚果派介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    3.Flutter与Dart介绍
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter3/3.1Flutter介绍.html">
            
                <a href="../chapter3/3.1Flutter介绍.html">
            
                    
                    3.1Flutter介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter3/3.2Dart介绍.html">
            
                <a href="../chapter3/3.2Dart介绍.html">
            
                    
                    3.2Dart介绍
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    4.HarmonyOS/OpenHarmony与ArkTS介绍
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter4/4.1HarmonyOS">
            
                <span>
            
                    
                    4.1HarmonyOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter4/4.2OpenHarmony.html">
            
                <a href="../chapter4/4.2OpenHarmony.html">
            
                    
                    4.2OpenHarmony
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter4/4.3HarmonyOSNEXT.html">
            
                <a href="../chapter4/4.3HarmonyOSNEXT.html">
            
                    
                    4.3HarmonyOS NEXT
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter4/4.4ArkTS语言 .html">
            
                <a href="../chapter4/4.4ArkTS语言 .html">
            
                    
                    4.4ArkTS语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../chapter4/4.5三者的差异 .md">
            
                <span>
            
                    
                    4.5三者的区别与联系
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    5.Flutter鸿蒙化
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    [5.1背景]
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" >
            
                <span>
            
                    
                    [5.2原理]
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter2/2.3Impeller渲染引擎.html">
            
                <a href="../chapter2/2.3Impeller渲染引擎.html">
            
                    
                    5.3Impeller渲染引擎
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    6.鸿蒙Flutter开发环境配置（windows与mac）
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter5/5.1windows环境配置.html">
            
                <a href="../chapter5/5.1windows环境配置.html">
            
                    
                    6.1windows环境配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter5/5.2mac环境配置.html">
            
                <a href="../chapter5/5.2mac环境配置.html">
            
                    
                    6.2 mac环境配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter5/5.6使用最新的fluttersdk配置开发环境.html">
            
                <a href="../chapter5/5.6使用最新的fluttersdk配置开发环境.html">
            
                    
                    6.3 使用 FlutterSDK 3.22.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../chapter5/5.4第一个鸿蒙Flutter应用程序.html">
            
                <a href="../chapter5/5.4第一个鸿蒙Flutter应用程序.html">
            
                    
                    6.4第一个鸿蒙Flutter应用程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../chapter5/5.5鸿蒙Flutter运行到HarmonyOS.md">
            
                <span>
            
                    
                    6.5运行到多平台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../chapter5/5.7OpenHarmony设备运行指导.html">
            
                <a href="../chapter5/5.7OpenHarmony设备运行指导.html">
            
                    
                    6.6OpenHarmony设备运行指导
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../chapter5/5.8现有项目支持鸿蒙.html">
            
                <a href="../chapter5/5.8现有项目支持鸿蒙.html">
            
                    
                    6.7现有Flutter项目支持鸿蒙
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../chapter5/5.9鸿蒙版Flutter仓库变更.html">
            
                <a href="../chapter5/5.9鸿蒙版Flutter仓库变更.html">
            
                    
                    6.8鸿蒙版Flutter仓库变更
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../chapter5/5.11使用fvm.html">
            
                <a href="../chapter5/5.11使用fvm.html">
            
                    
                    6.9使用FVM管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    7.在鸿蒙应用中添加Flutter页面
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" >
            
                <span>
            
                    
                    7.1如何使用 FlutterPage
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" >
            
                <span>
            
                    
                    7.2如何使用混合开发添加跳转 FlutterEntry
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" >
            
                <span>
            
                    
                    7.3 harmonyos添加flutter页面跳转时路由的处理
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                    8.在鸿蒙应用中使用Flutter Channel能力
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../chapter8/8.1如何使用Flutter与鸿蒙通信 FlutterChannel.html">
            
                <a href="../chapter8/8.1如何使用Flutter与鸿蒙通信 FlutterChannel.html">
            
                    
                    8.1如何使用Flutter与鸿蒙通信 FlutterChannel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../chapter8/8.4 混合渲染开发实践：以 fluttertpc_scan 三方库为例.html">
            
                <a href="../chapter8/8.4 混合渲染开发实践：以 fluttertpc_scan 三方库为例.html">
            
                    
                    8.4 混合渲染开发实践：以 fluttertpc_scan 三方库为例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" >
            
                <span>
            
                    
                    9.与原生混合渲染
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/Flutter OHOS外接纹理适配简介.md">
            
                    
                    9.1Flutter OHOS外接纹理适配简介.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/如何使用多引擎 FlutterEngineGroup.md">
            
                    
                    9.2如何使用多引擎 FlutterEngineGroup
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/如何使用PlatformView.md">
            
                    
                    9.3如何使用PlatformView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/PlatformView同层渲染方案适配切换指导.md">
            
                    
                    9.4PlatformView同层渲染方案适配切换指导
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" >
            
                <span>
            
                    
                    9.5如何使用混合开发 module
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    10.开发Flutter静态库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/如何使用混合开发 module.md">
            
                    
                    10.1开发module
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/开发package.md">
            
                    
                    10.2开发package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/开发plugin.md">
            
                    
                    10.3开发plugin
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/开发FFI plugin.md">
            
                    
                    10.4开发FFI plugin
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" >
            
                <span>
            
                    
                    11.Packages使用指南
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../chapter11/11.1高效使用 Packages指南.html">
            
                <a href="../chapter11/11.1高效使用 Packages指南.html">
            
                    
                    11.1高效使用 Packages指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" >
            
                <span>
            
                    
                    11.2发布Packages
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" >
            
                <span>
            
                    
                    12.鸿蒙适配Flutter三方库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="12.1纯dart库无需迁移.html">
            
                <a href="12.1纯dart库无需迁移.html">
            
                    
                    12.1纯dart库无需迁移
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="12.2坚果派已适配的库">
            
                <span>
            
                    
                    12.2坚果派目前适配三方库进展
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.12.3" data-path="12.3适配三方库之FlutterToast.html">
            
                <a href="12.3适配三方库之FlutterToast.html">
            
                    
                    12.3适配三方库之FlutterToast
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="12.4适配适配三方库之udid.md">
            
                <span>
            
                    
                    12.4适配三方库之udid
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="12.5适配torch_light.html">
            
                <a href="12.5适配torch_light.html">
            
                    
                    12.5适配torch_light.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="12.6适配flutter_native_contact_picker.html">
            
                <a href="12.6适配flutter_native_contact_picker.html">
            
                    
                    12.6适配flutter_native_contact_picker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="12.7适配flutter_timezone.html">
            
                <a href="12.7适配flutter_timezone.html">
            
                    
                    12.7适配flutter_timezone.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.8" data-path="12.8适配flutter_exit_app.html">
            
                <a href="12.8适配flutter_exit_app.html">
            
                    
                    12.8适配flutter_exit_app.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.9" data-path="12.9适配flutter_phone_direct_caller.html">
            
                <a href="12.9适配flutter_phone_direct_caller.html">
            
                    
                    12.9适配flutter_phone_direct_caller
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.10" data-path="12.10适配flutter_app_icon_badge.html">
            
                <a href="12.10适配flutter_app_icon_badge.html">
            
                    
                    12.10适配flutter_app_icon_badge
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.11" data-path="12.11适配memory_info.html">
            
                <a href="12.11适配memory_info.html">
            
                    
                    12.11适配memory_info
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" >
            
                <span>
            
                    
                    13.1DevTool使用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" >
            
                <span>
            
                    
                    13.1DevTool使用
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-delimitation.md">
            
                    
                    13.2性能分析定界(OpenHarmony平台)指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-threads-sequence.md">
            
                    
                    13.3性能分析第一步-梳理线程顺序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-frame-rendering-tracking.md">
            
                    
                    13.4性能分析-帧渲染跟踪
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-sliding-response-time.md">
            
                    
                    13.5性能分析-滑动响应时延
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="12.6如何调试代码">
            
                <span>
            
                    
                    13.6如何调试代码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" >
            
                <span>
            
                    
                    14.迁移实战
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" >
            
                <span>
            
                    
                    坚果驾考
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../chapter14/14.2使用url_launcher.html">
            
                <a href="../chapter14/14.2使用url_launcher.html">
            
                    
                    14.2使用url_launcher
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../chapter14/14.3flutter开发鸿蒙PC应用.html">
            
                <a href="../chapter14/14.3flutter开发鸿蒙PC应用.html">
            
                    
                    14.3flutter开发鸿蒙PC应用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" >
            
                <span>
            
                    
                    15.上架审核
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" >
            
                <span>
            
                    
                    16.FAQ
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/environment.md">
            
                    
                    16.1环境相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../chapter16/16.3权限相关.html">
            
                <a href="../chapter16/16.3权限相关.html">
            
                    
                    16.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_engine.md">
            
                    
                    ohos引擎产物编译相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_hap.md">
            
                    
                    ohos应用编译相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_code.md">
            
                    
                    ohos代码开发相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.6" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_run.md">
            
                    
                    ohos运行相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.7" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/README.md">
            
                    
                    功能开发相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.8" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/flutter_cppcrash_guideline.md">
            
                    
                    解析flutter相关的cppcrash堆栈
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" >
            
                <span>
            
                    
                    17.阅读更多
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" >
            
                <span>
            
                    
                    现有Flutter项目支持鸿蒙
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../chapter17/17.2平台判断与问题处理指南.html">
            
                <a href="../chapter17/17.2平台判断与问题处理指南.html">
            
                    
                    17.2平台判断与问题处理指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" >
            
                <span>
            
                    
                    18.关于未来
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" >
            
                <span>
            
                    
                    致谢
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >12.3适配三方库之FlutterToast</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             
                <div id="vip-container">
                    <h1 id="fluttertoast-&#x4E09;&#x65B9;&#x5E93;&#x9E3F;&#x8499;&#x9002;&#x914D;&#x4E4B;&#x65C5;&#xFF1A;&#x4ECE;&#x96F6;&#x5230;&#x4E00;&#x7684;&#x6DF1;&#x5EA6;&#x5B9E;&#x8DF5;"><a name="fluttertoast-&#x4E09;&#x65B9;&#x5E93;&#x9E3F;&#x8499;&#x9002;&#x914D;&#x4E4B;&#x65C5;&#xFF1A;&#x4ECE;&#x96F6;&#x5230;&#x4E00;&#x7684;&#x6DF1;&#x5EA6;&#x5B9E;&#x8DF5;" class="plugin-anchor" href="#fluttertoast-&#x4E09;&#x65B9;&#x5E93;&#x9E3F;&#x8499;&#x9002;&#x914D;&#x4E4B;&#x65C5;&#xFF1A;&#x4ECE;&#x96F6;&#x5230;&#x4E00;&#x7684;&#x6DF1;&#x5EA6;&#x5B9E;&#x8DF5;"><i class="fa fa-link" aria-hidden="true"></i></a>FlutterToast &#x4E09;&#x65B9;&#x5E93;&#x9E3F;&#x8499;&#x9002;&#x914D;&#x4E4B;&#x65C5;&#xFF1A;&#x4ECE;&#x96F6;&#x5230;&#x4E00;&#x7684;&#x6DF1;&#x5EA6;&#x5B9E;&#x8DF5;</h1>
<p>&#x5728;&#x6570;&#x5B57;&#x5316;&#x6D6A;&#x6F6E;&#x7684;&#x63A8;&#x52A8;&#x4E0B;&#xFF0C;&#x8DE8;&#x5E73;&#x53F0;&#x5F00;&#x53D1;&#x6846;&#x67B6;&#x5982; Flutter &#x51ED;&#x501F;&#x5176;&#x9AD8;&#x6548;&#x3001;&#x4FBF;&#x6377;&#x7684;&#x7279;&#x6027;&#xFF0C;&#x6210;&#x4E3A;&#x4E86;&#x5F00;&#x53D1;&#x8005;&#x4EEC;&#x7684;&#x5BA0;&#x513F;&#x3002;&#x800C;&#x9E3F;&#x8499;&#x7CFB;&#x7EDF;&#x7684;&#x5D1B;&#x8D77;&#xFF0C;&#x66F4;&#x662F;&#x4E3A;&#x8DE8;&#x5E73;&#x53F0;&#x5F00;&#x53D1;&#x6CE8;&#x5165;&#x4E86;&#x65B0;&#x7684;&#x6D3B;&#x529B;&#x3002;&#x4E3A;&#x4E86;&#x52A9;&#x529B;&#x5F00;&#x53D1;&#x8005;&#x5728;&#x9E3F;&#x8499;&#x751F;&#x6001;&#x4E2D;&#x5FEB;&#x901F;&#x5B9E;&#x73B0; FlutterToast &#x901A;&#x77E5;&#x529F;&#x80FD;&#xFF0C;&#x672C;&#x6587;&#x5C06;&#x6DF1;&#x5165;&#x6D45;&#x51FA;&#x5730;&#x4E3A;&#x5927;&#x5BB6;&#x89E3;&#x6790;&#x5982;&#x4F55;&#x9002;&#x914D; FlutterToast &#x4E09;&#x65B9;&#x5E93;&#x81F3;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x3002;</p>
<h2 id="&#x4E00;&#x3001;&#x9002;&#x914D;&#x9E3F;&#x8499;&#x7248;-fluttertoast-&#x4E09;&#x65B9;&#x5E93;"><a name="&#x4E00;&#x3001;&#x9002;&#x914D;&#x9E3F;&#x8499;&#x7248;-fluttertoast-&#x4E09;&#x65B9;&#x5E93;" class="plugin-anchor" href="#&#x4E00;&#x3001;&#x9002;&#x914D;&#x9E3F;&#x8499;&#x7248;-fluttertoast-&#x4E09;&#x65B9;&#x5E93;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E00;&#x3001;&#x9002;&#x914D;&#x9E3F;&#x8499;&#x7248; FlutterToast &#x4E09;&#x65B9;&#x5E93;</h2>
<h3 id="&#xFF08;&#x4E00;&#xFF09;&#x7248;&#x672C;&#x9009;&#x62E9;&#x4E0E;&#x4ED3;&#x5E93;&#x7B80;&#x4ECB;"><a name="&#xFF08;&#x4E00;&#xFF09;&#x7248;&#x672C;&#x9009;&#x62E9;&#x4E0E;&#x4ED3;&#x5E93;&#x7B80;&#x4ECB;" class="plugin-anchor" href="#&#xFF08;&#x4E00;&#xFF09;&#x7248;&#x672C;&#x9009;&#x62E9;&#x4E0E;&#x4ED3;&#x5E93;&#x7B80;&#x4ECB;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E00;&#xFF09;&#x7248;&#x672C;&#x9009;&#x62E9;&#x4E0E;&#x4ED3;&#x5E93;&#x7B80;&#x4ECB;</h3>
<p>&#x6211;&#x4EEC;&#x5148;&#x53BB; pub &#x4E0A;&#x67E5;&#x770B;&#x6700;&#x65B0;&#x7248;&#x672C;&#xFF0C;&#x53D1;&#x73B0;&#x76EE;&#x524D; pub &#x4E0A;&#x6700;&#x65B0;&#x662F; 8.2.12&#xFF0C;&#x800C; GitHub &#x7684;&#x6700;&#x65B0;&#x7248;&#x672C;&#x662F; 8.2.11&#x3002;&#x6211;&#x4EEC;&#x9009;&#x62E9;&#x4EE5; 8.2.11 &#x7248;&#x672C;&#x4E3A;&#x57FA;&#x7840;&#x8FDB;&#x884C;&#x9002;&#x914D;&#x3002;FlutterToast &#x662F;&#x4E00;&#x4E2A;&#x7528;&#x4E8E;&#x5728; Flutter &#x5E94;&#x7528;&#x4E2D;&#x663E;&#x793A;&#x81EA;&#x5B9A;&#x4E49; Toast &#x6D88;&#x606F;&#x7684;&#x63D2;&#x4EF6;&#xFF0C;&#x5176; GitHub &#x4ED3;&#x5E93;&#x4E3A; <a href="https://github.com/PonnamKarthik/FlutterToast" target="_blank">https://github.com/PonnamKarthik/FlutterToast</a> &#xFF0C;&#x6211;&#x4EEC;&#x7684;&#x76EE;&#x6807;&#x662F;&#x5C06;&#x8FD9;&#x4E2A;&#x63D2;&#x4EF6;&#x9002;&#x914D;&#x5230;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x3002;</p>
<h3 id="&#xFF08;&#x4E8C;&#xFF09;&#x5F15;&#x5165;&#x80CC;&#x666F;&#x4E0E;&#x4F7F;&#x7528;&#x573A;&#x666F;"><a name="&#xFF08;&#x4E8C;&#xFF09;&#x5F15;&#x5165;&#x80CC;&#x666F;&#x4E0E;&#x4F7F;&#x7528;&#x573A;&#x666F;" class="plugin-anchor" href="#&#xFF08;&#x4E8C;&#xFF09;&#x5F15;&#x5165;&#x80CC;&#x666F;&#x4E0E;&#x4F7F;&#x7528;&#x573A;&#x666F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E8C;&#xFF09;&#x5F15;&#x5165;&#x80CC;&#x666F;&#x4E0E;&#x4F7F;&#x7528;&#x573A;&#x666F;</h3>
<p>&#x5728; OpenHarmony &#x5317;&#x5411;&#x751F;&#x6001;&#x7684;&#x53D1;&#x5C55;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x8BB8;&#x591A;&#x5DF2;&#x7ECF;&#x9002;&#x914D;&#x4E86; Flutter &#x7684;&#x5382;&#x5546;&#x5728;&#x63A5;&#x5165; OpenHarmony &#x65F6;&#xFF0C;&#x90FD;&#x5E0C;&#x671B;&#x80FD;&#x591F;&#x7EE7;&#x7EED;&#x4F7F;&#x7528; FlutterToast &#x6765;&#x5B9E;&#x73B0;&#x901A;&#x77E5;&#x529F;&#x80FD;&#x3002;&#x56E0;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x8FD9;&#x4E2A;&#x9002;&#x914D;&#x65B9;&#x6848;&#xFF0C;&#x91C7;&#x7528;&#x63D2;&#x4EF6;&#x5316;&#x7684;&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#xFF0C;&#x5E2E;&#x52A9;&#x751F;&#x6001;&#x4F19;&#x4F34;&#x5FEB;&#x901F;&#x5B9E;&#x73B0;&#x4EA7;&#x54C1;&#x5316;&#x3002;</p>
<p>&#x672C;&#x65B9;&#x6848;&#x9002;&#x7528;&#x4E8E;&#x5DF2;&#x7ECF;&#x652F;&#x6301; Flutter &#x6846;&#x67B6;&#x7684;&#x8BBE;&#x5907;&#x5728;&#x79FB;&#x690D;&#x5230; OpenHarmony &#x7CFB;&#x7EDF;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x5907;&#x9009;&#x65B9;&#x6848;&#x3002;</p>
<h3 id="&#xFF08;&#x4E09;&#xFF09;&#x4F7F;&#x7528;&#x6587;&#x6863;&#x4E0E;&#x63D2;&#x4EF6;&#x5E93;&#x4F7F;&#x7528;"><a name="&#xFF08;&#x4E09;&#xFF09;&#x4F7F;&#x7528;&#x6587;&#x6863;&#x4E0E;&#x63D2;&#x4EF6;&#x5E93;&#x4F7F;&#x7528;" class="plugin-anchor" href="#&#xFF08;&#x4E09;&#xFF09;&#x4F7F;&#x7528;&#x6587;&#x6863;&#x4E0E;&#x63D2;&#x4EF6;&#x5E93;&#x4F7F;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E09;&#xFF09;&#x4F7F;&#x7528;&#x6587;&#x6863;&#x4E0E;&#x63D2;&#x4EF6;&#x5E93;&#x4F7F;&#x7528;</h3>
<p>&#x9002;&#x914D; OpenHarmony &#x5E73;&#x53F0;&#x7684;&#x8BE6;&#x7EC6;&#x4F7F;&#x7528;&#x6307;&#x5BFC;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#xFF1A;<a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/07_plugin/ohos%E5%B9%B3%E5%8F%B0%E9%80%82%E9%85%8Dflutter%E4%B8%89%E6%96%B9%E5%BA%93%E6%8C%87%E5%AF%BC.md" target="_blank">Flutter&#x4F7F;&#x7528;&#x6307;&#x5BFC;&#x6587;&#x6863;</a></p>
<p>&#x5728;&#x9879;&#x76EE;&#x4E2D;&#x4F7F;&#x7528;&#x8BE5;&#x63D2;&#x4EF6;&#x5E93;&#x65F6;&#xFF0C;&#x53EA;&#x9700;&#x5728; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x7684; <code>dependencies</code> &#x4E2D;&#x65B0;&#x589E;&#x5982;&#x4E0B;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  fluttertoast:</span>
<span class="hljs-attr">    git:</span>
<span class="hljs-attr">      url:</span> <span class="hljs-string">&quot;https://gitcode.com/nutpi/flutter_toast.git&quot;</span>
<span class="hljs-attr">      path:</span> <span class="hljs-string">&quot;&quot;</span>
</code></pre>
<p>&#x7136;&#x540E;&#x5728;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;&#x8FD0;&#x884C; <code>flutter pub get</code>&#xFF0C;&#x5373;&#x53EF;&#x5B8C;&#x6210;&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;</p>
<p>&#x63A5;&#x4E0B;&#x6765;&#x662F;&#x5177;&#x4F53;&#x7684;&#x9002;&#x914D;&#x8FC7;&#x7A0B;&#x3002;</p>
<h2 id="&#x4E8C;&#x3001;&#x9002;&#x914D;&#x8FC7;&#x7A0B;&#x8BE6;&#x89E3;"><a name="&#x4E8C;&#x3001;&#x9002;&#x914D;&#x8FC7;&#x7A0B;&#x8BE6;&#x89E3;" class="plugin-anchor" href="#&#x4E8C;&#x3001;&#x9002;&#x914D;&#x8FC7;&#x7A0B;&#x8BE6;&#x89E3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E8C;&#x3001;&#x9002;&#x914D;&#x8FC7;&#x7A0B;&#x8BE6;&#x89E3;</h2>
<h3 id="&#xFF08;&#x4E00;&#xFF09;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;"><a name="&#xFF08;&#x4E00;&#xFF09;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;" class="plugin-anchor" href="#&#xFF08;&#x4E00;&#xFF09;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E00;&#xFF09;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;</h3>
<p>&#x786E;&#x4FDD;&#x5DF2;&#x7ECF;&#x914D;&#x7F6E;&#x597D;&#x4E86; Flutter &#x5F00;&#x53D1;&#x73AF;&#x5883;&#xFF0C;&#x5177;&#x4F53;&#x53EF;&#x53C2;&#x8003; <a href="https://gitcode.com/openharmony-sig/flutter_flutter/blob/master/README.md" target="_blank">Flutter &#x914D;&#x7F6E;&#x6307;&#x5357;</a>&#x3002;&#x540C;&#x65F6;&#xFF0C;&#x4ECE; <a href="https://pub.dev/" target="_blank">&#x5B98;&#x65B9;&#x63D2;&#x4EF6;&#x5E93;</a> &#x4E0B;&#x8F7D;&#x5F85;&#x9002;&#x914D;&#x7684;&#x4E09;&#x65B9;&#x63D2;&#x4EF6;&#x3002;&#x672C;&#x6307;&#x5BFC;&#x4E66;&#xFF0C; &#x4EE5;&#x9002;&#x914D; <a href="https://pub-web.flutter-io.cn/packages/fluttertoast/versions/8.2.12" target="_blank">fluttertoast 8.2.12</a> &#x4E3A;&#x4F8B;</p>
<p><img src="https://nutpi-e41b.obs.cn-north-4.myhuaweicloud.com/image-20250417200546042.png" alt="image-20250417200546042"></p>
<h3 id="&#xFF08;&#x4E8C;&#xFF09;&#x63D2;&#x4EF6;&#x76EE;&#x5F55;&#x7ED3;&#x6784;"><a name="&#xFF08;&#x4E8C;&#xFF09;&#x63D2;&#x4EF6;&#x76EE;&#x5F55;&#x7ED3;&#x6784;" class="plugin-anchor" href="#&#xFF08;&#x4E8C;&#xFF09;&#x63D2;&#x4EF6;&#x76EE;&#x5F55;&#x7ED3;&#x6784;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E8C;&#xFF09;&#x63D2;&#x4EF6;&#x76EE;&#x5F55;&#x7ED3;&#x6784;</h3>
<p>&#x4E0B;&#x8F7D;&#x5E76;&#x89E3;&#x538B;&#x63D2;&#x4EF6;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x4F1A;&#x770B;&#x5230;&#x4EE5;&#x4E0B;&#x76EE;&#x5F55;&#x7ED3;&#x6784;&#xFF1A;</p>
<ul>
<li><strong>lib</strong> &#xFF1A;&#x5BF9;&#x63A5; Dart &#x7AEF;&#x4EE3;&#x7801;&#x7684;&#x5165;&#x53E3;&#xFF0C;&#x7531;&#x6B64;&#x6587;&#x4EF6;&#x63A5;&#x6536;&#x5230;&#x53C2;&#x6570;&#x540E;&#xFF0C;&#x901A;&#x8FC7; channel &#x5C06;&#x6570;&#x636E;&#x53D1;&#x9001;&#x5230;&#x539F;&#x751F;&#x7AEF;&#x3002;</li>
<li><strong>android</strong> &#xFF1A;&#x5B89;&#x5353;&#x7AEF;&#x4EE3;&#x7801;&#x5B9E;&#x73B0;&#x76EE;&#x5F55;&#x3002;</li>
<li><strong>ios</strong> &#xFF1A;iOS &#x539F;&#x751F;&#x7AEF;&#x5B9E;&#x73B0;&#x76EE;&#x5F55;&#x3002;</li>
<li><strong>example</strong> &#xFF1A;&#x4E00;&#x4E2A;&#x4F9D;&#x8D56;&#x4E8E;&#x8BE5;&#x63D2;&#x4EF6;&#x7684; Flutter &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;&#x7528;&#x4E8E;&#x8BF4;&#x660E;&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x5B83;&#x3002;</li>
<li><strong>README.md</strong> &#xFF1A;&#x4ECB;&#x7ECD;&#x5305;&#x7684;&#x6587;&#x4EF6;&#x3002;</li>
<li><strong>CHANGELOG.md</strong> &#xFF1A;&#x8BB0;&#x5F55;&#x6BCF;&#x4E2A;&#x7248;&#x672C;&#x4E2D;&#x7684;&#x66F4;&#x6539;&#x3002;</li>
<li><strong>LICENSE</strong> &#xFF1A;&#x5305;&#x542B;&#x8F6F;&#x4EF6;&#x5305;&#x8BB8;&#x53EF;&#x6761;&#x6B3E;&#x7684;&#x6587;&#x4EF6;&#x3002;</li>
</ul>
<h3 id="&#xFF08;&#x4E09;&#xFF09;&#x521B;&#x5EFA;&#x63D2;&#x4EF6;&#x7684;&#x9E3F;&#x8499;&#x6A21;&#x5757;"><a name="&#xFF08;&#x4E09;&#xFF09;&#x521B;&#x5EFA;&#x63D2;&#x4EF6;&#x7684;&#x9E3F;&#x8499;&#x6A21;&#x5757;" class="plugin-anchor" href="#&#xFF08;&#x4E09;&#xFF09;&#x521B;&#x5EFA;&#x63D2;&#x4EF6;&#x7684;&#x9E3F;&#x8499;&#x6A21;&#x5757;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E09;&#xFF09;&#x521B;&#x5EFA;&#x63D2;&#x4EF6;&#x7684;&#x9E3F;&#x8499;&#x6A21;&#x5757;</h3>
<p>&#x5728;&#x63D2;&#x4EF6;&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x6253;&#x5F00; Terminal&#xFF0C;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x6765;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x7684; Flutter &#x6A21;&#x5757;&#xFF1A;</p>
<pre><code>flutter create . --template=plugin --platforms=ohos
</code></pre><p>&#x6B65;&#x9AA4;&#xFF1A;</p>
<ol>
<li><p>&#x7528;vscode/trae&#x6253;&#x5F00;&#x521A;&#x521A;&#x4E0B;&#x8F7D;&#x597D;&#x7684;&#x63D2;&#x4EF6;&#x3002;</p>
</li>
<li><p>&#x6253;&#x5F00;Terminal&#xFF0C;cd&#x5230;&#x63D2;&#x4EF6;&#x76EE;&#x5F55;&#x4E0B;&#x3002;</p>
</li>
<li><p>&#x6267;&#x884C;&#x547D;&#x4EE4;<code>flutter create . --template=plugin --platforms=ohos</code> &#x521B;&#x5EFA;&#x4E00;&#x4E2A;ohos&#x5E73;&#x53F0;&#x7684;flutter&#x6A21;&#x5757;&#x3002;</p>
<p>&#x6267;&#x884C;&#x521B;&#x5EFA;&#x547D;&#x4EE4;&#x524D;</p>
<p><img src="https://nutpi-e41b.obs.cn-north-4.myhuaweicloud.com/image-20250417201357085.png" alt="image-20250417201357085"></p>
</li>
</ol>
<p>&#x6267;&#x884C;&#x521B;&#x5EFA;&#x547D;&#x4EE4;&#x540E;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;ohos&#x76EE;&#x5F55;&#x4E0B;&#x7684;.dart_tool&#x548C;.ldea&#x6587;&#x4EF6;&#x5220;&#x9664;&#x3002;</p>
<p><img src="../Users/jianguo/Library/Application Support/typora-user-images/image-20250417201538183.png" alt="image-20250417201538183"></p>
<h3 id="&#xFF08;&#x56DB;&#xFF09;&#x5728;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x6DFB;&#x52A0;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x914D;&#x7F6E;"><a name="&#xFF08;&#x56DB;&#xFF09;&#x5728;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x6DFB;&#x52A0;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x914D;&#x7F6E;" class="plugin-anchor" href="#&#xFF08;&#x56DB;&#xFF09;&#x5728;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x6DFB;&#x52A0;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x914D;&#x7F6E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x56DB;&#xFF09;&#x5728;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x6DFB;&#x52A0;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x914D;&#x7F6E;</h3>
<p>&#x5728;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;&#x7684; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x6DFB;&#x52A0;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x7684;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">name:</span> fluttertoast
<span class="hljs-attr">description:</span> Toast Library for Flutter, Easily create toast messages in single line of code
<span class="hljs-attr">version:</span> <span class="hljs-number">8.2</span><span class="hljs-number">.11</span>
<span class="hljs-attr">homepage:</span> https://github.com/PonnamKarthik/FlutterToast
<span class="hljs-attr">issue_tracker:</span> https://github.com/ponnamkarthik/FlutterToast/issues

<span class="hljs-attr">environment:</span>
<span class="hljs-attr">  sdk:</span> <span class="hljs-string">&quot;&gt;=2.12.0 &lt;4.0.0&quot;</span>
<span class="hljs-attr">  flutter:</span> <span class="hljs-string">&quot;&gt;=1.10.0&quot;</span>

<span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  flutter:</span>
<span class="hljs-attr">    sdk:</span> flutter
<span class="hljs-attr">  flutter_web_plugins:</span>
<span class="hljs-attr">    sdk:</span> flutter
<span class="hljs-attr">  web:</span> <span class="hljs-string">&quot;&gt;=1.0.0 &lt;2.0.0&quot;</span>

<span class="hljs-attr">flutter:</span>
<span class="hljs-attr">  plugin:</span>
<span class="hljs-attr">    platforms:</span>
<span class="hljs-attr">      android:</span>
<span class="hljs-attr">        package:</span> io.github.ponnamkarthik.toast.fluttertoast
<span class="hljs-attr">        pluginClass:</span> FlutterToastPlugin
<span class="hljs-attr">      ios:</span>
<span class="hljs-attr">        pluginClass:</span> FluttertoastPlugin
<span class="hljs-attr">      ohos:</span>
<span class="hljs-attr">        pluginClass:</span> FluttertoastPlugin
<span class="hljs-attr">      web:</span>
<span class="hljs-attr">        pluginClass:</span> FluttertoastWebPlugin
<span class="hljs-attr">        fileName:</span> fluttertoast_web.dart
<span class="hljs-attr">  assets:</span>
<span class="hljs-bullet">    -</span> assets/
</code></pre>
<h3 id="&#xFF08;&#x4E94;&#xFF09;&#x7F16;&#x5199;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x7684;&#x539F;&#x751F;-ets-&#x6A21;&#x5757;"><a name="&#xFF08;&#x4E94;&#xFF09;&#x7F16;&#x5199;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x7684;&#x539F;&#x751F;-ets-&#x6A21;&#x5757;" class="plugin-anchor" href="#&#xFF08;&#x4E94;&#xFF09;&#x7F16;&#x5199;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x7684;&#x539F;&#x751F;-ets-&#x6A21;&#x5757;"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x4E94;&#xFF09;&#x7F16;&#x5199;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x7684;&#x539F;&#x751F; ETS &#x6A21;&#x5757;</h3>
<h4 id="1-&#x521B;&#x5EFA;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x6A21;&#x5757;"><a name="1-&#x521B;&#x5EFA;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x6A21;&#x5757;" class="plugin-anchor" href="#1-&#x521B;&#x5EFA;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x6A21;&#x5757;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x521B;&#x5EFA;&#x9E3F;&#x8499;&#x63D2;&#x4EF6;&#x6A21;&#x5757;</h4>
<p>&#x4F7F;&#x7528; DevEco Studio &#x6253;&#x5F00;&#x9E3F;&#x8499;&#x9879;&#x76EE;&#x3002;</p>
<h4 id="2-&#x4FEE;&#x6539;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#x6587;&#x4EF6;"><a name="2-&#x4FEE;&#x6539;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#x6587;&#x4EF6;" class="plugin-anchor" href="#2-&#x4FEE;&#x6539;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#x6587;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x4FEE;&#x6539;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#x6587;&#x4EF6;</h4>
<p>&#x5728; <code>ohos</code> &#x76EE;&#x5F55;&#x5185;&#x7684; <code>oh-package.json5</code> &#x6587;&#x4EF6;&#x4E2D;&#x6DFB;&#x52A0; <code>libs/flutter.har</code> &#x4F9D;&#x8D56;&#xFF0C;&#x5E76;&#x521B;&#x5EFA; <code>.gitignore</code> &#x6587;&#x4EF6;&#xFF0C;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#x4EE5;&#x5FFD;&#x7565; <code>libs</code> &#x76EE;&#x5F55;&#xFF1A;</p>
<pre><code>/node_modules
/oh_modules
/local.properties
/.preview
/.idea
/build
/libs
/.cxx
/.test
/BuildProfile.ets
/oh-package-lock.json5
</code></pre><p><code>oh-package.json5</code> &#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code>{
  &quot;name&quot;: &quot;fluttertoast&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;Please describe the basic information.&quot;,
  &quot;main&quot;: &quot;index.ets&quot;,
  &quot;author&quot;: &quot;&#x575A;&#x679C;&#x6D3E;&quot;,
  &quot;license&quot;: &quot;Apache-2.0&quot;,
  &quot;dependencies&quot;: {
    &quot;@ohos/flutter_ohos&quot;: &quot;file:./libs/flutter.har&quot;
  }
}
</code></pre><p>&#x5728; <code>ohos</code> &#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA; <code>index.ets</code> &#x6587;&#x4EF6;&#xFF0C;&#x5BFC;&#x51FA;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre><code>

import FluttertoastPlugin from &apos;./src/main/ets/toast/FlutterToastPlugin&apos;;
export default FluttertoastPlugin;
</code></pre><h4 id="3-&#x7F16;&#x5199;-ets-&#x4EE3;&#x7801;"><a name="3-&#x7F16;&#x5199;-ets-&#x4EE3;&#x7801;" class="plugin-anchor" href="#3-&#x7F16;&#x5199;-ets-&#x4EE3;&#x7801;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x7F16;&#x5199; ETS &#x4EE3;&#x7801;</h4>
<p>&#x6587;&#x4EF6;&#x7ED3;&#x6784;&#x548C;&#x4EE3;&#x7801;&#x903B;&#x8F91;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x5B89;&#x5353;&#x6216; iOS &#x7684;&#x5B9E;&#x73B0;&#xFF0C;&#x9E3F;&#x8499;&#x7684; API &#x6587;&#x6863;&#x53EF;&#x4EE5;&#x53C2;&#x8003; &#xFF1A;<a href="https://gitcode.com/openharmony-sig/flutter_packages/tree/master/packages/path_provider/path_provider_android" target="_blank">https://gitcode.com/openharmony-sig/flutter_packages/tree/master/packages/path_provider/path_provider_android</a></p>
<p>ohos&#x7684;api&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#xFF1A;<a href="https://gitcode.com/openharmony/docs" target="_blank">https://gitcode.com/openharmony/docs</a></p>
<p>&#x4EE5;&#x4E0B;&#x662F; <code>FlutterToastPlugin.ets</code> &#x6587;&#x4EF6;&#x7684;&#x4EE3;&#x7801;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-comment">/*
 * Copyright (c) 2025 Hihope Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */</span>
<span class="hljs-keyword">import</span> MethodChannel <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/plugin/common/MethodChannel&apos;</span>;
<span class="hljs-keyword">import</span> { BinaryMessenger } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger&apos;</span>
<span class="hljs-keyword">import</span> {
  FlutterPlugin,
  FlutterPluginBinding
} <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin&apos;</span>;
<span class="hljs-keyword">import</span> MethodCallHandlerImpl <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;./MethodCallHandlerImpl&apos;</span>
<span class="hljs-keyword">import</span> StandardMethodCodec <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/plugin/common/StandardMethodCodec&apos;</span>

<span class="hljs-keyword">const</span> TAG = <span class="hljs-string">&quot;FlutterToastPlugin&quot;</span>

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FlutterToastPlugin</span> <span class="hljs-title">implements</span> <span class="hljs-title">FlutterPlugin</span> </span>{
  private channel: MethodChannel | <span class="hljs-literal">null</span> = <span class="hljs-literal">null</span>;

  getUniqueClassName(): string {
    <span class="hljs-keyword">return</span> TAG;
  }

  onAttachedToEngine(binding: FlutterPluginBinding): <span class="hljs-keyword">void</span> {
    <span class="hljs-keyword">this</span>.setupChannel(binding.getBinaryMessenger());
  }

  onDetachedFromEngine(binding: FlutterPluginBinding): <span class="hljs-keyword">void</span> {
    <span class="hljs-keyword">this</span>.teardownChannel();
  }

  private setupChannel(messenger: BinaryMessenger) {
    <span class="hljs-keyword">let</span> that = <span class="hljs-keyword">this</span>;
    <span class="hljs-keyword">this</span>.channel = <span class="hljs-keyword">new</span> MethodChannel(messenger, <span class="hljs-string">&quot;PonnamKarthik/fluttertoast&quot;</span>, StandardMethodCodec.INSTANCE);
    <span class="hljs-keyword">let</span> handler = <span class="hljs-keyword">new</span> MethodCallHandlerImpl();
    <span class="hljs-keyword">this</span>.channel.setMethodCallHandler(handler);
  }

  private teardownChannel() {
    <span class="hljs-keyword">this</span>.channel?.setMethodCallHandler(<span class="hljs-literal">null</span>)
    <span class="hljs-keyword">this</span>.channel = <span class="hljs-literal">null</span>
  }
}
</code></pre>
<p>&#x4EE5;&#x4E0B;&#x662F; <code>MethodCallHandlerImpl.ets</code> &#x6587;&#x4EF6;&#x7684;&#x4EE3;&#x7801;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-comment">/*
 * Copyright (c) 2025 Hihope Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */</span>
<span class="hljs-keyword">import</span> { promptAction } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@kit.ArkUI&apos;</span>;
<span class="hljs-keyword">import</span> { MethodCallHandler, MethodResult } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/plugin/common/MethodChannel&apos;</span>;
<span class="hljs-keyword">import</span> MethodCall <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/plugin/common/MethodCall&apos;</span>;
<span class="hljs-keyword">import</span> Log <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@ohos/flutter_ohos/src/main/ets/util/Log&apos;</span>;
<span class="hljs-keyword">const</span> TAG = <span class="hljs-string">&apos;MethodCallHandlerImpl&apos;</span>;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MethodCallHandlerImpl</span> <span class="hljs-title">implements</span> <span class="hljs-title">MethodCallHandler</span> </span>{
  onMethodCall(call: MethodCall, result: MethodResult): <span class="hljs-keyword">void</span> {
    <span class="hljs-keyword">let</span> that = <span class="hljs-keyword">this</span>;
    <span class="hljs-keyword">switch</span> (call.method) {
      <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;showToast&apos;</span>:
          <span class="hljs-keyword">let</span> msg: string = call.argument(<span class="hljs-string">&apos;msg&apos;</span>) || <span class="hljs-string">&apos;&apos;</span>;
          <span class="hljs-keyword">let</span> length: string = call.argument(<span class="hljs-string">&apos;length&apos;</span>)?.toString() || <span class="hljs-string">&apos;short&apos;</span>;
          <span class="hljs-keyword">let</span> time: number = call.argument(<span class="hljs-string">&apos;timeInSecForIosWeb&apos;</span>) * <span class="hljs-number">1000</span> || (length === <span class="hljs-string">&apos;long&apos;</span> ? <span class="hljs-number">3500</span> : <span class="hljs-number">2000</span>);
          <span class="hljs-keyword">let</span> bgcolor: string = call.argument(<span class="hljs-string">&quot;bgcolor&quot;</span>) ? <span class="hljs-string">&apos;#&apos;</span> + call.argument(<span class="hljs-string">&quot;bgcolor&quot;</span>).toString(<span class="hljs-number">16</span>) : <span class="hljs-string">&apos;&apos;</span>;
          <span class="hljs-keyword">let</span> textcolor: string = call.argument(<span class="hljs-string">&quot;textcolor&quot;</span>) ? <span class="hljs-string">&apos;#&apos;</span> + call.argument(<span class="hljs-string">&quot;textcolor&quot;</span>).toString(<span class="hljs-number">16</span>) : <span class="hljs-string">&apos;&apos;</span>;
          <span class="hljs-keyword">let</span> textSize: number = call.argument(<span class="hljs-string">&quot;fontSize&quot;</span>) || <span class="hljs-number">16.0</span>;
          <span class="hljs-keyword">let</span> gravity: Alignment;

          <span class="hljs-keyword">switch</span>(call.argument(<span class="hljs-string">&quot;gravity&quot;</span>)) {
            <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;top&apos;</span>:
              gravity = Alignment.Top;
              <span class="hljs-keyword">break</span>;
            <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;center&apos;</span>:
              gravity = Alignment.Center;
              <span class="hljs-keyword">break</span>;
            <span class="hljs-keyword">default</span>:
              gravity = Alignment.Bottom;
          }

          <span class="hljs-keyword">try</span> {
            promptAction.showToast({
              message: msg,
              duration: time,
              backgroundColor: bgcolor,
              textColor: textcolor,
              alignment: gravity,
              backgroundBlurStyle: BlurStyle.NONE
            });
          } <span class="hljs-keyword">catch</span> (e) {
            Log.e(TAG, <span class="hljs-string">&quot;Show toast error: &quot;</span> + e);
          }

        result.success(<span class="hljs-literal">true</span>);
        <span class="hljs-keyword">break</span>;
      <span class="hljs-keyword">case</span> <span class="hljs-string">&apos;cancel&apos;</span>:
        result.success(<span class="hljs-literal">true</span>);
        <span class="hljs-keyword">break</span>;
      <span class="hljs-keyword">default</span>:
        result.notImplemented();
        <span class="hljs-keyword">break</span>;
    }
  }
}
</code></pre>
<h4 id="4-&#x4FEE;&#x6539;-index-&#x6587;&#x4EF6;"><a name="4-&#x4FEE;&#x6539;-index-&#x6587;&#x4EF6;" class="plugin-anchor" href="#4-&#x4FEE;&#x6539;-index-&#x6587;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x4FEE;&#x6539; index &#x6587;&#x4EF6;</h4>
<p>&#x5728; <code>ohos</code> &#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA; <code>index.ets</code> &#x6587;&#x4EF6;&#xFF0C;&#x5BFC;&#x51FA; <code>FlutterToastPlugin</code>&#xFF1A;</p>
<pre><code>

import FluttertoastPlugin from &apos;./src/main/ets/toast/FlutterToastPlugin&apos;;
export default FluttertoastPlugin;
</code></pre><h3 id="&#xFF08;&#x516D;&#xFF09;&#x7F16;&#x5199;-example"><a name="&#xFF08;&#x516D;&#xFF09;&#x7F16;&#x5199;-example" class="plugin-anchor" href="#&#xFF08;&#x516D;&#xFF09;&#x7F16;&#x5199;-example"><i class="fa fa-link" aria-hidden="true"></i></a>&#xFF08;&#x516D;&#xFF09;&#x7F16;&#x5199; Example</h3>
<h4 id="1-&#x521B;&#x5EFA;-example-&#x5E94;&#x7528;"><a name="1-&#x521B;&#x5EFA;-example-&#x5E94;&#x7528;" class="plugin-anchor" href="#1-&#x521B;&#x5EFA;-example-&#x5E94;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x521B;&#x5EFA; Example &#x5E94;&#x7528;</h4>
<p>&#x5728;&#x63D2;&#x4EF6;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x540D;&#x4E3A; <code>example</code> &#x7684;&#x6587;&#x4EF6;&#x5939;&#xFF0C;&#x7528;&#x4E8E;&#x5B58;&#x653E;&#x793A;&#x4F8B;&#x5E94;&#x7528;&#x3002;&#x5728; <code>example</code> &#x6587;&#x4EF6;&#x5939;&#x4E2D;&#xFF0C;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x7684; Flutter &#x5E94;&#x7528;&#xFF0C;&#x7528;&#x4E8E;&#x9A8C;&#x8BC1;&#x63D2;&#x4EF6;&#x529F;&#x80FD;&#x3002;</p>
<h4 id="2-&#x7B7E;&#x540D;&#x4E0E;&#x8FD0;&#x884C;"><a name="2-&#x7B7E;&#x540D;&#x4E0E;&#x8FD0;&#x884C;" class="plugin-anchor" href="#2-&#x7B7E;&#x540D;&#x4E0E;&#x8FD0;&#x884C;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x7B7E;&#x540D;&#x4E0E;&#x8FD0;&#x884C;</h4>
<p>&#x4F7F;&#x7528; <code>Deveco Studio</code> &#x6253;&#x5F00; <code>example &gt; ohos</code> &#x76EE;&#x5F55;&#xFF0C;&#x5355;&#x51FB; <code>File &gt; Project Structure &gt; Project &gt; Signing Configs</code>&#xFF0C;&#x52FE;&#x9009; <code>Automatically generate signature</code>&#xFF0C;&#x7B49;&#x5F85;&#x81EA;&#x52A8;&#x7B7E;&#x540D;&#x5B8C;&#x6210;&#x3002;&#x7136;&#x540E;&#x8FD0;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code>flutter pub get

 flutter build hap --debug
</code></pre><p>&#x5982;&#x679C;&#x5E94;&#x7528;&#x6B63;&#x5E38;&#x542F;&#x52A8;&#xFF0C;&#x8BF4;&#x660E;&#x63D2;&#x4EF6;&#x9002;&#x914D;&#x6210;&#x529F;&#x3002;&#x5982;&#x679C;&#x6CA1;&#x6709;&#xFF0C;&#x6B22;&#x8FCE;&#x5927;&#x5BB6;&#x8054;&#x7CFB;&#x575A;&#x679C;&#x6D3E;&#x4E00;&#x8D77;&#x652F;&#x6301;&#x3002;</p>
<h2 id="&#x4E09;&#x3001;&#x603B;&#x7ED3;"><a name="&#x4E09;&#x3001;&#x603B;&#x7ED3;" class="plugin-anchor" href="#&#x4E09;&#x3001;&#x603B;&#x7ED3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E09;&#x3001;&#x603B;&#x7ED3;</h2>
<p>&#x901A;&#x8FC7;&#x4EE5;&#x4E0A;&#x6B65;&#x9AA4;&#xFF0C;&#x6211;&#x4EEC;&#x6210;&#x529F;&#x5730;&#x5C06; FlutterToast &#x4E09;&#x65B9;&#x5E93;&#x9002;&#x914D;&#x5230;&#x4E86;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#x3002;&#x8FD9;&#x4E2A;&#x8FC7;&#x7A0B;&#x6D89;&#x53CA;&#x5230;&#x4E86;&#x89E3;&#x63D2;&#x4EF6;&#x7684;&#x57FA;&#x672C;&#x4FE1;&#x606F;&#x3001;&#x914D;&#x7F6E;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x3001;&#x521B;&#x5EFA;&#x9E3F;&#x8499;&#x6A21;&#x5757;&#x3001;&#x7F16;&#x5199;&#x539F;&#x751F;&#x4EE3;&#x7801;&#x4EE5;&#x53CA;&#x6D4B;&#x8BD5;&#x9A8C;&#x8BC1;&#x7B49;&#x591A;&#x4E2A;&#x73AF;&#x8282;&#x3002;&#x5E0C;&#x671B;&#x8FD9;&#x7BC7;&#x535A;&#x5BA2;&#x80FD;&#x591F;&#x5E2E;&#x52A9;&#x5230;&#x9700;&#x8981;&#x8FDB;&#x884C; FlutterToast &#x9E3F;&#x8499;&#x9002;&#x914D;&#x7684;&#x5F00;&#x53D1;&#x8005;&#x4EEC;&#xFF0C;&#x8BA9;&#x5927;&#x5BB6;&#x5728;&#x9E3F;&#x8499;&#x751F;&#x6001;&#x7684;&#x5F00;&#x53D1;&#x4E2D;&#x66F4;&#x52A0;&#x5F97;&#x5FC3;&#x5E94;&#x624B;&#x3002;</p>
<h2 id="&#x56DB;&#x3001;&#x53C2;&#x8003;"><a name="&#x56DB;&#x3001;&#x53C2;&#x8003;" class="plugin-anchor" href="#&#x56DB;&#x3001;&#x53C2;&#x8003;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x56DB;&#x3001;&#x53C2;&#x8003;</h2>
<ul>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5982;&#x4F55;&#x4F7F;&#x7528;Flutter&#x4E0E;OpenHarmony&#x901A;&#x4FE1; FlutterChannel.md" target="_blank">&#x5982;&#x4F55;&#x4F7F;&#x7528;Flutter&#x4E0E;OpenHarmony&#x901A;&#x4FE1; FlutterChannel</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x6DF7;&#x5408;&#x5F00;&#x53D1; module.md" target="_blank">&#x5F00;&#x53D1;module</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5F00;&#x53D1;package.md" target="_blank">&#x5F00;&#x53D1;package</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5F00;&#x53D1;plugin.md" target="_blank">&#x5F00;&#x53D1;plugin</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5F00;&#x53D1;FFI plugin.md" target="_blank">&#x5F00;&#x53D1;FFI plugin</a></li>
<li><a href="https://docs.flutter.cn/packages-and-plugins/developing-packages" target="_blank"></a></li>
</ul>
<h2 id="&#x575A;&#x679C;&#x6D3E;"><a name="&#x575A;&#x679C;&#x6D3E;" class="plugin-anchor" href="#&#x575A;&#x679C;&#x6D3E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x575A;&#x679C;&#x6D3E;</h2>
<p>&#x575A;&#x679C;&#x6D3E;&#x7531;&#x575A;&#x679C;&#x7B49;&#x4EBA;&#x521B;&#x5EFA;&#xFF0C;&#x56E2;&#x961F;&#x62E5;&#x6709;&#x82E5;&#x5E72;&#x534E;&#x4E3A;HDE&#xFF0C;&#x4EE5;&#x53CA;&#x82E5;&#x5E72;&#x5176;&#x4ED6;&#x9886;&#x57DF;&#x7684;&#x4E09;&#x5341;&#x4F59;&#x4F4D;&#x4E07;&#x7C89;&#x535A;&#x4E3B;&#x8FD0;&#x8425;&#x3002;&#x4E13;&#x6CE8;&#x4E8E;&#x5206;&#x4EAB;&#x7684;&#x6280;&#x672F;&#x5305;&#x62EC;HarmonyOS/OpenHarmony&#xFF0C;ArkUI-X&#xFF0C;&#x5143;&#x670D;&#x52A1;&#xFF0C;&#x670D;&#x52A1;&#x5361;&#x7247;&#xFF0C;&#x534E;&#x4E3A;&#x81EA;&#x7814;&#x8BED;&#x8A00;&#xFF0C;BlueOS&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x3001;&#x56E2;&#x961F;&#x6210;&#x5458;&#x805A;&#x96C6;&#x5728;&#x5317;&#x4EAC;&#x3001;&#x4E0A;&#x6D77;&#x3001;&#x5E7F;&#x5DDE;&#x3001;&#x6DF1;&#x5733;&#x3001;&#x5357;&#x4EAC;&#x3001;&#x676D;&#x5DDE;&#x3001;&#x82CF;&#x5DDE;&#x3001;&#x5B81;&#x590F;&#x7B49;&#x5730;&#x3002; &#x805A;&#x7126;&#x201C;&#x9E3F;&#x8499;&#x539F;&#x751F;&#x5E94;&#x7528;&#x201D;&#x3001;&#x201C;&#x667A;&#x80FD;&#x7269;&#x8054;&#x201D;&#x548C;&#x201C;AI&#x8D4B;&#x80FD;&#x201D;&#x3001;&#x201C;&#x4EBA;&#x5DE5;&#x667A;&#x80FD;&#x201D;&#x56DB;&#x5927;&#x4E1A;&#x52A1;&#x9886;&#x57DF;&#xFF0C;&#x4F9D;&#x6258;&#x534E;&#x4E3A;&#x5F00;&#x53D1;&#x8005;&#x4E13;&#x5BB6;&#x7B49;&#x5F3A;&#x5927;&#x7684;&#x6280;&#x672F;&#x56E2;&#x961F;&#xFF0C;&#x4EE5;&#x53CA;&#x6DB5;&#x76D6;&#x9700;&#x6C42;&#x3001;&#x5F00;&#x53D1;&#x3001;&#x6D4B;&#x8BD5;&#x3001;&#x8FD0;&#x7EF4;&#x4E8E;&#x4E00;&#x4F53;&#x7684;&#x7EFC;&#x5408;&#x670D;&#x52A1;&#x4F53;&#x7CFB;&#xFF0C;&#x8D4B;&#x80FD;&#x6587;&#x65C5;&#x3001;&#x5A92;&#x4F53;&#x3001;&#x793E;&#x4EA4;&#x3001;&#x5BB6;&#x5C45;&#x3001;&#x6D88;&#x8D39;&#x7535;&#x5B50;&#x7B49;&#x884C;&#x4E1A;&#x5BA2;&#x6237;&#xFF0C;&#x6EE1;&#x8DB3;&#x793E;&#x533A;&#x5BA2;&#x6237;&#x6570;&#x5B57;&#x5316;&#x5347;&#x7EA7;&#x8F6C;&#x578B;&#x7684;&#x9700;&#x6C42;&#xFF0C;&#x5E2E;&#x52A9;&#x5BA2;&#x6237;&#x5B9E;&#x73B0;&#x4EF7;&#x503C;&#x63D0;&#x5347;&#x3002; &#x76EE;&#x524D;&#x4E0A;&#x67B6;&#x9E3F;&#x8499;&#x539F;&#x751F;&#x5E94;&#x7528;18&#x6B3E;&#xFF0C;&#x4E09;&#x65B9;&#x5E93;72&#x4E2A;&#x3002;</p>
<p>&#x5730;&#x5740;&#xFF1A;<a href="https://atomgit.com/nutpi" target="_blank">https://atomgit.com/nutpi</a></p>
<p><a href="https://gitcode.com/nutpi" target="_blank">https://gitcode.com/nutpi</a></p>
<footer class="page-footer"><span class="copyright">powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2025-04-25 08:14:40
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                </div>
                <script src="https://my.openwrite.cn/js/readmore.js"></script>
                <script>
                    var enablePlugin = false;
                    var allowDomain = "localhost";
                    if(allowDomain){
                        var currentDomain = location.hostname;
                        if ($.isArray(allowDomain)) {
                            $.each(allowDomain, function(index, item) {
                                if (currentDomain == item) {
                                    enablePlugin = true;
                                    return false;
                                }
                            });
                        }else{
                           if (currentDomain == allowDomain) {
                                enablePlugin = true;
                            }
                        }
                    }else{
                        enablePlugin = true;
                    }
                    
                    if(enablePlugin){
                        var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
                        if (!isMobile) {
                            var btw = new BTWPlugin();
                            btw.init({"allowDomain":"localhost","blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果","id":"vip-container"});
                        }
                    }
                </script> 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
          <div class="book-footer">
            
            <div class="donate">
              <div></div>
              <button class="donate-btn" onclick="showModal()">赞赏</button>
            </div>
             
            <div class="copyright"></div>
            
          </div>
          
        </div>
      </div>
      
    </div>

     
    <a
      href="12.2坚果派已适配的库"
      class="
        navigation navigation-prev
        
      "
      aria-label="Previous page: 12.2坚果派目前适配三方库进展"
    >
      <i class="fa fa-angle-left"></i>
    </a>
     
    <a
      href="12.4适配适配三方库之udid.md"
      class="
        navigation navigation-next
        
      "
      aria-label="Next page: 12.4适配三方库之udid"
    >
      <i class="fa fa-angle-right"></i>
    </a>
      
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"12.3适配三方库之FlutterToast","level":"1.12.3","depth":2,"next":{"title":"12.4适配三方库之udid","level":"1.12.4","depth":2,"path":"chapter12/12.4适配适配三方库之udid.md","ref":"./chapter12/12.4适配适配三方库之udid.md","articles":[]},"previous":{"title":"12.2坚果派目前适配三方库进展","level":"1.12.2","depth":2,"path":"chapter12/12.2坚果派已适配的库","ref":"./chapter12/12.2坚果派已适配的库","articles":[]},"dir":"ltr"},"config":{"plugins":["github-buttons@2.1.0","edit-link","splitter","tbfed-pagefooter","expandable-chapters","chapter-fold","back-to-top-button","code","pageview-count","popup","search-plus","-lunr","-search","splitter","-sharing","sharing-plus","theme-lou","mind-maps","emphasize","anchors","changyan","readmore","livereload","ace","livereload"],"root":".","styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"expandable-chapters":{}},"emphasize":{},"ace":{},"livereload":{},"splitter":{},"readmore":{"allowDomain":"localhost","blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果"},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"theme-lou":{"hide-elements":[".summary .gitbook-link",".summary .divider"],"color":"#FF4848","book-anchor-title":"本章目录","copyright":{"author":"vx:nut_pie"},"forbidCopy":true,"logo":"assets/avatar.png","book-summary-title":"文章目录","search-placeholder":"输入关键字搜索","copyrightLogo":"assets/copyright.png","favicon":"assets/avatar.png","appleTouchIconPrecomposed152":"assets/avatar.png"},"changyan":{"appid":"cyvHoCPAs","conf":"0440cfc4168ba95d73cfc52dd4d5c60b"},"fontsettings":{"theme":"white","family":"sans","size":2},"mind-maps":{},"highlight":{},"back-to-top-button":{},"pageview-count":{},"github-buttons":{"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"},"sharing":{"qq":false,"all":["qq","qzone","whatsapp","douban","facebook","google","instapaper","linkedin","messenger","twitter","weibo"],"douban":false,"facebook":false,"weibo":false,"twitter":false,"pocket":false,"google":false,"qzone":false},"edit-link":{"label":"编辑此页","base":"https://github.com/ITmxs/gitbook/edit/master/"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"坚果派","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://www.gitbook.com/","name":"坚果派官网"},{"target":"_blank","url":"https://www.npmjs.com/package/package","name":"ArkUI实战"},{"target":"_blank","url":"https://space.bilibili.com/480883651","name":"元服务开发实践"},{"target":"_blank","url":"https://blog.51cto.com/jianguo","name":"OpenHarmony应用开发"}],"footer":{"donate":{"wechat":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","message":"随意打赏，但不要超过一顿早餐钱 💕","wxpay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","alipay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png","nickname":"breeze","button":"打赏","wechatText":"微信","alipayText":"支付宝","title":"『赠人玫瑰 🌹 手有余香 』","avatar":"http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"},"copyright":true}}},"title":"Flutter for Harmony教程","language":"zh-hans","gitbook":"*","description":"Flutter for Harmony电子书教程"},"file":{"path":"chapter12/12.3适配三方库之FlutterToast.md","mtime":"2025-04-25T00:14:40.784Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2025-05-22T05:24:30.737Z"},"basePath":"..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mind-maps/mindmaps.dist.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-changyan/changyan.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

